//
//  AppDelegate+HYAppService.m
//  TJHYHardwareProduct
//
//  Created by yc on 2017/12/25.
//  Copyright © 2017年 Cong Yao. All rights reserved.
//

#import "AppDelegate+HYAppService.h"
#import <Bugly/Bugly.h>
//#import <KSCrash/KSCrashInstallationStandard.h>
@implementation AppDelegate (HYAppService)


- (void)setNetworkBaseConfig
{
    YTKNetworkConfig *config = [YTKNetworkConfig sharedConfig];
    config.baseUrl = ZHYServerURL;
}

- (void)setKSCrashConfig
{
//    KSCrashInstallationStandard* installation = [KSCrashInstallationStandard sharedInstance];
//    installation.url = [NSURL URLWithString:@"https://collector.bughd.com/kscrash?key=050e4c6d7a4de971d0d32116fb65b739"];
//    [installation install];
//    [installation sendAllReportsWithCompletion:nil];
}

- (void)setBuglyConfig
{
    [Bugly startWithAppId:@"ef80765c40"];
}

- (void)setWindowBaseConfig
{
    [[IQKeyboardManager sharedManager]setEnable:YES];
    [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
    [[IQKeyboardManager sharedManager] setKeyboardDistanceFromTextField:100];
    
    [SVProgressHUD setAnimationDuration:2.0];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    [SVProgressHUD dismissWithDelay:5];
}

- (void)setNetworkMonitorConfig {
    self.hostReach = [Reachability reachabilityWithHostname:@"www.baidu.com"];
    self.hostReach.reachableBlock = ^(Reachability * reachability)
    {
        NSLog(@"========%@",[NSString getNetWorkStates]);
        NSString * temp = [NSString stringWithFormat:@"BAIDU Block Says Reachable(%@)", reachability.currentReachabilityString];
        NSLog(@"%@", temp);
        if (reachability.currentReachabilityStatus == ReachableViaWiFi){
            
        }else{
            [[NSNotificationCenter defaultCenter] postNotificationName:NOTIFY_NET_CHANGE object:nil];
        }
    };
    
    self.hostReach.unreachableBlock = ^(Reachability * reachability)
    {
        if (![NSString getDeviceSSID]) {
            [[NSNotificationCenter defaultCenter] postNotificationName:NOTIFY_NET_CHANGE object:nil];
        }
    };
    
    [self.hostReach startNotifier];
}


@end
